<?php
/**
 * @version		0.2.0 joomla zmluvy $
 * @package		com_zjmluvy
 * @copyright	Copyright © 2011 - All rights reserved.
 * @license		GNU/GPL
 * @author    AdrianKo		
 * @website   http://code.google.com/p/joomla-zmluvy
 *
 *
 *1.3.2012
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controller');

class jzmluvyControllerNastaveni extends JController
{

	function __construct()
	{
		parent::__construct();
		
		// Registrace extra dotazu
		$this->registerTask( 'apply', 	'save'  );
	}
	
		function save()
	{
		JRequest::checkToken() or die( 'Invalid Token' );
		
		$task		= JRequest::getVar('task');

		$post = JRequest::get( 'post' );
    $post['intro'] = JRequest::getVar( 'intro', '', 'post','string', JREQUEST_ALLOWRAW );
		$post['intro']	= str_replace( '<br>', '<br />', $post['intro'] );

		$model = $this->getModel('nastaveni');
		
		$returnid = $model->store($post);

		switch ($task)
		{
			case 'apply' :
				$link = 'index.php?option=com_jzmluvy&view=nastaveni';
				break;

			default :
				$link = 'index.php?option=com_jzmluvy';
				break;
		}
		$msg	= JText::_('INFO_ULOZENE_NASTAVENIE');

//		$model->checkin();

		$this->setRedirect( $link, $msg );
 	}
} 	

?>